package com.oocl.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

public class BatchUtil {

	public static <T> void batchWrite(List<T> t) throws Exception {

		ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(
				new File("book.txt")));
		out.writeObject(t);
		out.close();
	}

	public static <T> List<T> batchRead() throws Exception {

		ObjectInputStream in = new ObjectInputStream(new FileInputStream(
				new File("book.txt")));
		@SuppressWarnings("unchecked")
		List<T> tList = (List<T>) in.readObject();
		in.close();
		return tList;
	}

}
